Imports DTO
Imports BUS
Public Class frmChinhSuaHeThong
    Private lphgDto As LoaiPhong_Dto

    Private Sub frmChinhSuaHeThong_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        lphgDto = New LoaiPhong_Dto()
        Dim lpBus As New LoaiPhong_Bus()
        Dim ds As IList
        ds = lpBus.LayDanhSach()

        cmbLoaiPHG.DataSource = ds
        cmbLoaiPHG.ValueMember = "MaLoai"
        cmbLoaiPHG.DisplayMember = "TenLoaiPHG"

        cmbLoaiPHG.SelectedItem = lphgDto
    End Sub

    Private Sub cmbLoaiPHG_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbLoaiPHG.SelectedIndexChanged
        Try
            lphgDto = cmbLoaiPHG.SelectedItem
            txtDonGia.Text = lphgDto.DonGia.ToString()
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub btnDongY_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDongY.Click

        Try
            ' Cap nhat gia thue phong
            lphgDto.DonGia = txtDonGia.Text
            Dim lpBus As New LoaiPhong_Bus()
            lpBus.Sua(lphgDto)
            MessageBox.Show("Da dieu chinh lai gia phong.", "", MessageBoxButtons.OK, MessageBoxIcon.Information)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
       
    End Sub

    Private Sub btnThoat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnThoat.Click
        Me.Close()
    End Sub


End Class